package com.teamwork_backend.mapper;

import com.teamwork_backend.entity.UserInfo;
import com.teamwork_backend.entity.Users;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.teamwork_backend.entity.ov.UsersListView;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author windy
 * @since 2021-04-25
 */
public interface UsersDao extends BaseMapper<Users> {

    @Select("SELECT users.userid,account,createtime,nickname,userimg,sex,phone,residence FROM users LEFT JOIN `user_info` on users.userid = user_info.userid WHERE type = #{type} AND (account LIKE CONCAT('%',#{content},'%') OR nickname LIKE CONCAT('%',#{content},'%'))")
    List<UsersListView> getUserInfo(@Param("type") int type,@Param("content") String content);
}
